KE.lang['code'] = "插入代码";
KE.plugin['code'] = {
	click:function(c){
		KE.util.selection(c);
		this.dialog=new KE.dialog({
			 id:c,
			 cmd:"code",
			 file:"code.html",
			 width:500,
			 height:350,
			 loadingMode:true,
			 title:KE.lang['code'],
			 yesButton:KE.lang['yes'],
			 noButton:KE.lang['no']
		 });
		this.dialog.show();
	},escape:function(c){
		return c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\'/g,"&#39;");
	},check:function(e){
		var c=KE.util.getIframeDoc(this.dialog.iframe);
		var d=KE.$("lang",c).value;
		if(!d){
			alert(KE.lang.invalidLang);
			return false;
		}
		return true;
	},exec:function(f){
		var c=KE.util.getIframeDoc(this.dialog.iframe);
		var e=KE.$("lang",c).value;
		var d=KE.$("code",c).value;
		if(!this.check(f)){
			return false;
		}
		KE.util.insertHtml(f,'<pre class="brush:'+e+';">'+this.escape(d)+"</pre>");
		this.dialog.hide();KE.util.focus(f);
	}
};
